package com.mryang.hds.controller;

import com.mryang.hds.entity.EchartsEntity;
import com.mryang.hds.service.ManageECService;
import com.mryang.hds.utils.JWTUtil;
import com.mryang.hds.utils.ResultJson;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.print.RasterPrinterJob;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.net.HttpCookie;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Genius
 * @version 1.0.0
 * @ClassName ManageECController.java
 * @Description TODO ECharts控制类
 * @createTime 2023年01月24日 11:33:00
 */

@RestController
@RequestMapping("/api/manageec")
public class ManageECController {

    @Resource
    private ManageECService manageECService;

    @GetMapping("/getUClassify")
    public ResultJson getUClassify() {

        Map<String, Integer> uClassify = manageECService.getUClassify();


        return ResultJson.success(uClassify, "数据统计成功!");
    }

    @GetMapping("/getUPunch")
    public ResultJson getUPunch() {

        Map<String, Integer> uClassify = manageECService.getUPunch();


        return ResultJson.success(uClassify, "数据统计成功!");
    }

    @GetMapping("/getPunchData")
    public ResultJson getPunchData() {

        Map<String, Integer> uClassify = manageECService.getPunchData();


        return ResultJson.success(uClassify, "数据统计成功!");
    }

    // 获取 后台管理平台：数据展示页面相关数据
    @GetMapping("/getdatadisplay")
    public ResultJson getDataDisplay(){
        EchartsEntity dataDisplay = manageECService.getDataDisplay();

        return ResultJson.success(dataDisplay, "数据统计成功!");
    }

    // 获取打卡相关信息
    @GetMapping("/getECmain2Data")
    public ResultJson getECmain2Data(HttpServletRequest httpServletRequest){
        Integer loginId = JWTUtil.getTokenInfoIndex(httpServletRequest.getHeader("token"));
        Map<String, Integer> eCmain2Data = manageECService.getECmain2Data(loginId);
        return  ResultJson.success(eCmain2Data);
    }

    // 获取 需求审核、隔离审核相关数据详情
    @GetMapping("/getNeedOrGeLi")
    public ResultJson getNeedOrGeLi(HttpServletRequest httpServletRequest){
        Integer loginId = JWTUtil.getTokenInfoIndex(httpServletRequest.getHeader("token"));
        Map<String, Integer> eCmain2Data = manageECService.getNeedOrGeLi(loginId);
        return  ResultJson.success(eCmain2Data);

    }


}
